<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 浅拷贝 | 深拷贝  ==> 栈 堆 <==     -->
    <script>
      // 构建字面量对象时使用展开语法
      let person = { name: '哈哈', age: 22, a: { b: { c: 'cc' } } };

      let p = { ...person }; // 浅拷贝   只拷贝了栈
      console.log(p);

      p.a.b.c = 'cxh';
      p.age = 23;
      console.log(person);
      console.log(p);
    </script>
  </body>
</html>
